home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / tests / flts.tst < prev    next >
Text File  |  1999-09-16  |  841b  |  33 lines

  1. Leps=1.e-10;
  2. //test for flts
  3.  a=[1 2 3;
  4.     0 2 4
  5.     0 0 1];
  6.  b=[1 0;0 0;0 1];
  7.  c=eye(3,3);
  8. //
  9.  s=syslin('d',a,b,c);
  10.  h=ss2tf(s);
  11.  u=[1;-1]*(1:10);
  12. //
  13.  yh=flts(u,h); ys=flts(u,s);
  14. if norm(yh-ys)> Leps then pause,end
  15. //hot restart
  16.  [ys1,x]=flts(u(:,1:4),s);ys2=flts(u(:,5:10),s,x);
  17.   if norm([ys1 ys2]-ys)>sqrt(%eps) then pause,end
  18.   yh1=flts(u(:,1:4),h);yh2=flts(u(:,5:10),h,[u(:,2:4); yh(:,2:4)]);
  19.   if norm([yh1 yh2]-yh)>sqrt(%eps) then pause,end
  20. //d<>0
  21.  d=[-3 8;4 -0.5;2.2 0.9];
  22.  s=syslin('d',a,b,c,d);
  23.  h=ss2tf(s);
  24.  u=[1;-1]*(1:10);
  25. //
  26.  rh=flts(u,h); rs=flts(u,s);
  27. if norm(rh-rs) > Leps then pause,end
  28. //hot restart
  29.  [ys1,x]=flts(u(:,1:4),s);ys2=flts(u(:,5:10),s,x);
  30.   if norm([ys1 ys2]-rs)>sqrt(%eps) then pause,end
  31.   yh1=flts(u(:,1:4),h);yh2=flts(u(:,5:10),h,[u(:,2:4); yh1(:,2:4)]);
  32.   if norm([yh1 yh2]-rh)>sqrt(%eps) then pause,end
  33.